#ifndef _ipcGetData_h_
#define _ipcGetData_h_

#include "common/common.h"

#define MAX_PERMIT_SIZE (1024*1024)

typedef void(*IPCameraRecvCallBackFunc)(unsigned char *data, const int data_size, const unsigned int time_stamp, const unsigned int channelIndex, void *context);


typedef struct
{
	char cUrl[256];
	char cIp[64];
	int  iPort;
	char cUsr[80];
	char cPassWd[80];

	int  iFrameRate;

	int  iAudioDelay;
	int  iAudioObjectType;
	int  iAudioSamplingFrequencyIndex;
	int  iAudioChannelConfiguration;
}Camera;

typedef struct
{
	int is_start;
	IPCameraRecvCallBackFunc pCallBack;
	pthread_t deal_thread_id;
	pthread_t connect_thread_id;

	int iTcpSock;
	int iRtpSock;
	int iRtcpSock;
	int iRtpPort;
	int iRtcpPort;
	int iRemoteRtpPort;
	int iRemoteRtcpPort;

	int iFrameRate;

	char cTrackVideo[80];
	char cSession[80];
	char cBuf1[1024 * 1024];
	char cBuf2[4 * 1024];
	char cBak1[4 * 1024];
	char cBak2[4 * 1024];
	char cTmp1[4 * 1024];
	//char cTmp2[4 * 1024];

	int iDataSize;
	unsigned char ucData1[2 * 1024 * 1024];

	BlockInfo codeBlockInfo;
	Camera camera;

	unsigned int uiIncrementTimestamp;
	unsigned int timestamp;

	unsigned int sequenceIndex1;
	unsigned int sequenceIndex2;
	unsigned int timestamp1;
	unsigned int timestamp2;

	unsigned int frameIndex;
	unsigned int channelndex;

	void* context;
}CameraInfo;


static const int maxCodeSize = 2 * 1024 * 1024;

static const int maxBlockBufNumber = 1024;
static const int blockSize = 4 * 1024 * 1024;

//static const int cameraClientUdpMinPort = 7000;
//static const int cameraClientUdpMaxPort = 7100;

static const int cameraClientUdpMinPort = 30000;
static const int cameraClientUdpMaxPort = 30100;

static const unsigned int udpSockSendBufSize = 1 * 1024 * 1024;
static const unsigned int udpSockRecvBufSize = 1 * 1024 * 1024;

static const int getBlockDataTimeInterval_S = 1;

static const int tcpConnectWaitTime_S = 5;
static const int connectThreadSleepTime_S = 5;
static const int rtspSendWaitTime_S = 5;
static const int rtspRecvWaitTime_S = 5;

static const int maxContentLen = 32 * 1024;
static const int maxSessionLen = 1024;

static const int recvDataLenEachTime = 4096;
static const int recvRtpDataLenEachTime = 1000 * 1024;


int initCamera(CameraInfo *pCameraInfo);


#endif
